<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>门店修改</title>
    <link rel="stylesheet" href="../../../component/pear/css/pear.css" />
</head>
<body>
<form class="layui-form" action="">
    <div class="mainBox">
        <div class="main-container">
            <div class="layui-form-item layui-inline">
                <label class="layui-form-label">症状类型</label>
                <div class="layui-input-inline">
                    <input type="text" name="symtype" placeholder="" class="layui-input">
                </div>
            </div>
<!--            <div class="layui-form-item layui-inline">-->
<!--                <label class="layui-form-label">是否启用</label>-->
<!--                <div class="layui-input-inline">-->
<!--                    <input type="text" name="isvalid" placeholder="" class="layui-input">-->
<!--                </div>-->
<!--            </div>-->

            <div class="layui-form-item">
                <label class="layui-form-label">是否启用</label>
                <div class="layui-input-block">
                    <input type="radio" name="isvalid" value="1" title="启用" >
                    <input type="radio" name="isvalid" value="0" title="不启用">
                </div>
            </div>

        </div>
    </div>
    <div class="bottom">
        <div class="button-container">
            <button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit=""
                    lay-filter="user-save">
                <i class="layui-icon layui-icon-ok"></i>
                提交
            </button>
            <button type="reset" class="pear-btn pear-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</form>
<script src="../../../component/layui/layui.js"></script>
<script src="../../../component/pear/pear.js"></script>
<script>
    layui.use(['form', 'jquery','upload'], function() {
        let form = layui.form;
        let $ = layui.jquery;
        var upload = layui.upload;
        $.ajaxSetup({
            headers:{
                'Authorization':window.sessionStorage.getItem("token")
            }
        })
        $(function (){
            $.getJSON(window.BASEPATH+"symtype/select/"+sessionStorage.getItem("id"),
                function(res){
                    if(res.code!=0)
                        return layer.msg('信息检索失败');
                    let data=res.data;
                    $("[name='symtype']").val(data.symtype);
                    $('[name="isvalid"]').filter('[value="' + (data.isvalid ? "1" : "0") + '"]').prop("checked", true);

                    form.render();

                });
        })
        form.on('submit(user-save)', function(data) {
            data.field.id=sessionStorage.getItem("id");
            $.ajax({
                url: window.BASEPATH+'symtype/edit',
                data:data.field,
                type: 'post',
                success: function(result) {
                    if (result.code==0) {
                        layer.msg(result.msg,{
                            icon: 1,
                            time: 1000
                        }, function() {
                            parent.layer.close(parent.layer.getFrameIndex(window.name)); //关闭当前页
                            parent.layui.table.reload("user-table");
                        });
                    } else {
                        layer.msg(result.msg, {
                            icon: 2,
                            time: 1000
                        });
                    }
                }
            })
            return false;
        });


    })
</script>
<script>
</script>
</body>
</html>
